package com.ikas.ai.server.kafka;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 初始化topic,一个设备一个独立的topic，且分区都为1,(为保证消费顺序)
 */
@Configuration
public class KafkaInitialConfiguration {

    /**
     * 机组工况流程topic
     */
    public final static String TOPIC_U01 = "U01";
    public final static String TOPIC_U02 = "U02";
    public final static String TOPIC_U03 = "U03";
    public final static String TOPIC_U04 = "U04";
    public final static String WORK_FLOW_TOPIC_GROUP = "WORK_FLOW_TOPIC_GROUP";
    /**
     * 最新数据更新topic
     */
    public final static String TOPIC_U_DATA = "UDATA";
    /**
     * 机组跳机测点topic
     */
    public final static String TOPIC_MACHINE_TRIP = "MACHINE_TRIP";

    /**
     * 从104服务消费104上报数据topic
     */
    public final static String TOPIC_104 = "104_DATA";
    public final static String TOPIC_104_GROUP = "METE_DATA_104_GROUP";

    /**
     * 从达梦取工况流程数据后自发自消
     */
//    public final static String DM_METE_HIS_TOPIC = "DM_METE_HIS_TOPIC";
//    public final static String DM_METE_HIS_GROUP_ID = "DM_METE_HIS_GROUP_ID";
    /**
     * 机组跳机测点topic
     */
    public final static String TOPIC_MACHINE_TRIP_GROUP = "TOPIC_MACHINE_TRIP_GROUP";
    /**
     * 工况执行项响应项时长计算发送topic
     */
    public final static String WORK_INSTANCE_DETAIL_DELAY = "WORK_INSTANCE_DETAIL_DELAY";
//    执行项响应项时长统计
    public final static String WORK_INSTANCE_DETAIL_DELAY_GROUP = "WORK_INSTANCE_DETAIL_DELAY_GROUP";
    //触发评价模型和工况测点劣化预警
//    public final static String ASSESS_UNIT_DETERIORATION_GROUP = "ASSESS_UNIT_DETERIORATION_GROUP";

    /**
     * 工况步骤时长计算后发送topic
     */
    public final static String WORK_INSTANCE_STEP_DELAY = "WORK_INSTANCE_STEP_DELAY";
    public final static String WORK_INSTANCE_STEP_DELAY_GROUP = "WORK_INSTANCE_STEP_DELAY_GROUP";

    /**
     * T_DATAtopic
     */
    public final static String TOPIC_U_DATA_GROUP = "T_DATA";
    public final static String TOPIC_GROUP_STEADY = "STEADY";


    @Bean
    public NewTopic initialTopicU01() {
        return new NewTopic(TOPIC_U01, 1, (short) 3);
    }

    @Bean
    public NewTopic initialTopicU02() {
        return new NewTopic(TOPIC_U02, 1, (short) 3);
    }


    @Bean
    public NewTopic initialTopicU03() {
        return new NewTopic(TOPIC_U03, 1, (short) 3);
    }

    @Bean
    public NewTopic initialTopicU04() {
        return new NewTopic(TOPIC_U04, 1, (short) 3);
    }

    @Bean
    public NewTopic initialTopicTrip() {
        return new NewTopic(TOPIC_MACHINE_TRIP, 1, (short) 3);
    }

    @Bean
    public NewTopic initialTopicUDATA() {
        return new NewTopic(TOPIC_U_DATA, 1, (short) 3);
    }

    @Bean
    public NewTopic initialTopic104() {
        return new NewTopic(TOPIC_104, 1, (short) 3);
    }

//    @Bean
//    public NewTopic initialTopicDMTrip() {
//        return new NewTopic(DM_METE_HIS_TOPIC, 1, (short) 3);
//    }


    @Bean
    public NewTopic initialTopicWorkInstanceDetailDelay() {
        return new NewTopic(WORK_INSTANCE_DETAIL_DELAY, 1, (short) 3);
    }

    @Bean
    public NewTopic initialTopicWorkInstanceStepDelay() {
        return new NewTopic(WORK_INSTANCE_STEP_DELAY, 1, (short) 3);
    }

}